"use strict";

/*1.导包*/
import {Router} from  'express';

/*2.创建Rourer路由器*/
const router=Router();




/*
* get/
*
* */

router.use((req,res,next)=>{
    const viewRoot="home/";
    res.view=(name,data)=>{
         res.render(viewRoot+name,data)
    };
    next();
});


router.get('/',(req,res)=>{
    res.view('index.hbs',{title:'首页'});

});


router.get('/about',(req,res)=>{
    res.view('about.hbs',{title:'首页'});

});



router.get('/contact',(req,res)=>{
    res.view('contact.hbs',{title:'首页'});

});




/*3.导出路由前缀*/
export  const prefix="/";

export default router;